﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using HZ.Supervise.Model;

namespace HZ.Supervise.Web.Message
{
    public partial class MessageCompanyDetailForType3 : System.Web.UI.Page
    {
        IBLL.IBLL_MessageTypeDetail ibllMessage = new BLL.BLL_MessageTypeDetail();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //ViewState["query"] = URLUtil.GetSuperviseQueryFromURL(Request);
                BindList();
            }
        }

        void BindList()
        {
            string MessageDetailId = Request.QueryString["MessageDetailId"].ToString();
            int count = 0;

            Model.MessageSend messSend = new MessageSend();
            messSend.UserId = CurrentAccount.UserID.ToString();
            messSend.MessageDetailId = MessageDetailId;

            gvwMessageDetailList.DataSource = ibllMessage.GetMessagSend(messSend, AspNetPager1.CurrentPageIndex, AspNetPager1.PageSize, out count);
            gvwMessageDetailList.DataBind();
            AspNetPager1.RecordCount = count;
        }       

        protected void gvwMessageDetailList_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "DirectByDetail")
            {
                GridViewRow row = ((Control)e.CommandSource).NamingContainer as GridViewRow;
                string _strCompanyId = e.CommandArgument.ToString();
                string _strMessageId = Convert.ToString(this.gvwMessageDetailList.DataKeys[row.RowIndex].Value);
                Response.Redirect("MessageFinalDetailForType3.aspx?CompanyId=" + _strCompanyId+"&MessDetailId="+_strMessageId);
            }
        }
        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            BindList();
        }

        protected void btnExit_Click(object sender, EventArgs e)
        {

        }
    }
}
